Generating a count of a number of entries in node or a number of entries in a node and any nested nodes in a directory database is useful for a variety of reasons. One reason may be for licensing of software in an enterprise. For example, if an enterprise has a particular operating system such as MICROSOFT WINDOWS on each of its computers then a directory database may store a list of nodes corresponding to the businesses in the enterprise. Each of these nodes may contain a list of entries that may identify each of the computers in the corresponding business, the person assigned to the computer, and any other useful information as attributes of each of the entries. By counting the number of computers in each of the businesses a total number of computers in the enterprise may be determined wherein licensing fees for the operating system or other software may then be accurately assessed and paid by the enterprise.
Another reason why generating a count of entries may be important in a directory database may be to ensure efficient operation of the database. For example, a particular vendor for a directory database may know that the database works most efficiently up to a particular number of entries on each branch of a directory information tree. With that in mind, a count may be done for the number of entries on each branch in a directory database in order to ensure efficient operation. If it is found that the number of entries on a branch is too large then a new branch may be created to more evenly distribute the entries in the directory database.
Typically lightweight directory access protocol (LDAP) servers perform counts by starting at a particular base node, or context, in the directory, iteratively counting each entry in the node, and making a determination of the existence of all of the sub-nodes under the base node. For each sub-node an iterative count and determination is similarly made until the counting algorithm reaches the leaf nodes, those nodes that do not have any sub-nodes. As directory databases get large, running simple searches and counts as described above gets extremely long and/or may cause the search to crash. Further, in large enterprises there may be a plurality of directory servers, wherein each directory server may be supported by a different vendor. Currently, each directory server would have to be individually searched and counted since there is no way to centralize the search and count across the various databases. Further, each vendor may have proprietary controls or attributes that may assist in performing these counts, however, there does not exist any way to utilize these proprietary features in a distributed directory environment.